<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="java.util.List"%>
<%@ page isELIgnored="false" %> <%--isELIgnored=true禁用EL表达式--%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>充值页面</title>
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/layui-v2.6.13/layui/css/layui.css"/>
            <script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.min-2.1.1.js"></script>
            <script type="text/javascript" src="<%=request.getContextPath() %>/layui-v2.6.13/layui/layui.js"></script>
	</head>
	<body>
		<div style="width: 100%; margin: 0 auto;">
			<input type="text" class="layui-input" placeholder="请输入充值金额" id="recharge">
			<br>
			<button class="layui-btn layui-btn-fluid" onclick="pay()">支付</button>
			<input type="hidden" value="'${user.uPhone}'"  id = "phone">
		</div>
		<script>
		    function pay(){
		        var recharge = $("#recharge").val();
		        var phone = $("#phone").val()
		        console.info(recharge+"||"+phone);
		        var params = "id="+${user.id}+"&uMoney="+${user.uMoney}+"&recharge="+recharge+"&uPhone="+phone;
		        console.info(params);
		        //提交充值后金额
		        $.ajax({
		            url:"recharge",
		            data:params,
		            type:"post",
		            success: function(str){
		                console.info(str);
                        if(str == "1"){
                            alert("充值成功");
                            parent.location.reload();
                        }else{
                            alert("充值失败");
                        }
		            }
		        });

		    }
		</script>
	</body>
</html>